<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"  %>
<%@ page import="mysql.*"  %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Lucene Manage</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap-responsive.min.css" rel="stylesheet"
	type="text/css" />
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="css/style-metro.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/style-responsive.css" rel="stylesheet" type="text/css" />
<link href="css/default.css" rel="stylesheet" type="text/css"
	id="style_color" />
</head>
<body class="page-header-fixed page-boxed">
	<!-- HEADER -->
	<div class="header navbar navbar-inverse navbar-fixed-top">
		<div class="navbar-inner">
			<div class="container">
				<a class="brand" href="index.jsp" style="padding-left: 20px;">
					Lucene Manage</a>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="page-container row-fluid">
			<div class="page-sidebar nav-collapse collapse">
				<ul class="page-sidebar-menu">
					<li><div class="sidebar-toggler hidden-phone"></div></li>
					<li>
						<div class="sidebar-search"></div>
					</li>
					<li class="start "><a href="index.jsp"> <i
							class="icon-home"></i> <span class="title">主页</span>
					</a></li>
					<li class="active "><a href="javascript:;"> <i
							class="icon-cogs"></i> <span class="title">管理</span> <span
							class="selected"></span> <span class="arrow open"></span>
					</a>
						<ul class="sub-menu">
							<li class="active"><a href="index.jsp">配置Lucene服务器</a></li>
						</ul></li>
				</ul>
			</div>
			<div class="page-content">
				<div class="container-fluid">
					<div class="row-fluid">
						<div class="span12">
							<h3 class="page-title">
								配置Lucene服务器 <small></small>
							</h3>
							<ul class="breadcrumb">
								<li><i class="icon-home"></i> <a href="index.jsp">主页</a> <i
									class="icon-angle-right"></i></li>
								<li><a href="#">管理</a> <i class="icon-angle-right"></i></li>
								<li><a href="index.jsp">配置lucene服务器</a></li>
							</ul>
						</div>
					</div>
					<div class="row-fluid">
						<div class="portlet box grey">
							<div class="portlet-title">
								<div class="caption">
									<i class="icon-cogs"></i>服务器列表
								</div>
								<div class="tools">
									<a class="btn green" href="#"
										style="margin-top: -10px; padding-top: 2px;"> 
										<i class="icon-pencil"></i>添加
									</a> 
									<a href="javascript:;" class="collapse"></a> 
									<a href="javascript:;" class="reload"></a>
								</div>
							</div>
							<div class="portlet-body">
								<table class="table table-hover">
									<thead>
										<tr>
											<th></th>
											<th>#</th>
											<th>服务器名称</th>
											<th>ip地址</th>
											<th>端口号</th>
											<th>备注</th>
											<th></th>
										</tr>
									</thead>
									<tbody>
									<%
									Connection conn=DB.getConnection();
									String sql="SELECT * FROM `lucene_info` ";
									Statement stmt= conn.createStatement();
									ResultSet rs=stmt.executeQuery(sql);
									try{
										while(rs.next()){
										/* 	int id=rs.getInt(1);
											String name=rs.getString(2);
											String ip=rs.getString(3);
											int port=rs.getInt(4);
											String remark=rs.getString(5);
											int total_m=rs.getInt(6);
											int used_m=rs.getInt(7);
											String first=rs.getDate(8).toString();
											String last=rs.getDate(9).toString(); */
											int id=rs.getInt("id");
											String name=rs.getString("lucene_name");
											String ip=rs.getString("lucene_ip");
											int port=rs.getInt("lucene_port");
											String remark=rs.getString("remark");
											int total_m=rs.getInt("total_memory");
											int used_m=rs.getInt("used_memory");
											String first="2013-2-3 00:00:00";
											String last="2013-2-3 00:00:00";
											
									%>								
																	
										<tr>
											<td><span>+</span></td>
											<td><%=id %></td>
											<td><%=name %></td>
											<td><%=ip %></td>
											<td><%=port %></td>
											<td><%=remark %></td>
											<td>
												<div style="display: block;">
													<a class="btn mini purple" href="#"> <i
														class="icon-edit"></i>编辑
													</a>
												</div>
												<div style="display: none;">
													<a class="btn mini purple" href="#"> <i
														class="icon-edit"></i>保存
													</a> <a class="btn mini black" href="#"> <i
														class="icon-trash"></i>取消
													</a>
												</div>
											</td>
											<td>
												<div style="display: block;">
													<a class="btn mini black" href="#"> <i
														class="icon-trash"></i>删除
													</a>
												</div>
												<div style="display: none;">
													<a class="btn mini purple" href="#"> <i
														class="icon-edit"></i>确定
													</a> <a class="btn mini black" href="#"> <i
														class="icon-trash"></i>取消
													</a>
												</div>
											</td>
										</tr>
										<tr>
											<td colspan="8"><br>
												<div class="progress progress-striped active">
												<% double per=(double)used_m/total_m * 100;
												java.math.BigDecimal big= new java.math.BigDecimal(per);
												String  l = big.setScale(2,java.math.BigDecimal.ROUND_HALF_UP).doubleValue() +"%";
												%>
													<div style="width: <%=l %>;" class="bar"></div>
												</div>
												
												<span style="margin-right:20px">已用空间：<%=used_m %>M</span>
												<span style="margin-right:20px">可用空间:<%=total_m-used_m %>M</span> 
												<span style="margin-right:20px">最早插入时间：<%=first %></span> 
												<span style="margin-right:20px">最近插入时间：<%=last %></span>
											</td>
										</tr>
										
										<%
										}
											
										
									}catch (Exception e){}
									finally {
										DB.closeConnection(conn);
									}
									
									%>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="footer">
		<div class="container">
			<div class="footer-inner">2014 &copy;</div>
		</div>
	</div>
	<script src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
	<script src="js/bootstrap.min.js" type="text/javascript"></script>
	<script src="js/app.js"></script>
	<script>
		jQuery(document).ready(function() {
			App.init();
		});
	</script>
</body>
</html>